import {Badge, Space, Tag} from "antd";
import {ColumnsType} from "antd/es/table";
import {Link} from "react-router-dom";
import {Report} from "type/entity/Report";
import {columnDataIndex, columnOrder, columnRemark, ellipsisHandler} from "./index";

const reportColumns: ColumnsType<Report> = [
    columnDataIndex,
    {
        key: 'id',
        dataIndex: 'id',
        title: '流水号',
        width: 130,
        align: "center",
        render: (value, record) => <Link to={"detail"} state={record}>R-{value}</Link>
    },
    {
        key: 'explain',
        dataIndex: 'explain',
        title: '报销单说明',
        width: 110,
        align: "center",
    },
    {
        key: 'totalCount',
        dataIndex: 'totalCount',
        title: '报销项数量',
        width: 110,
        align: "center",
    },
    {
        key: 'totalAmount',
        dataIndex: 'totalAmount',
        title: '总金额',
        width: 110,
        align: "center",
    },
    {
        key: 'status',
        dataIndex: 'status',
        title: '报销状态',
        width: 110,
        align: "center",
        render: value => value ? <Badge status="success" />: <Badge status="error" />,
    },
    {
        key: 'settleTime',
        dataIndex: 'settleTime',
        title: '结算时间',
        width: 120,
        align: "center",
        ellipsis: {showTitle: false},
        render: ellipsisHandler
    },
    {
        key: 'createDate',
        dataIndex: 'createDate',
        title: '创建日期',
        width: 110,
        align: "center",
    },
    // columnOrder,
    columnRemark,
    {
        key: "options",
        title: "操作",
        dataIndex: "options",
        align: "center",
        width: 80,
        fixed: "right",
        render: (_, record, __) => <Link key={"report-update"} to={"update"} state={record}>更新</Link>
    }
];
export default reportColumns;
